package com.ekuaitu.kuaitu.activity;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.View;

import com.ekuaitu.kuaitu.R;
import com.ekuaitu.kuaitu.base.BaseActivity;
import com.ekuaitu.kuaitu.utils.KuaituDialog;
import com.ekuaitu.kuaitu.utils.MyApplication;
import com.ekuaitu.kuaitu.utils.StatusBarUtil;

import butterknife.OnClick;

/**
 * Created by jieyaozu on 2017/7/24.
 * 额外费用
 */

public class ExtraCostActivity extends BaseActivity {
    private Context mContext = this;

    @Override
    public int getLayoutId() {
        return R.layout.activity_extra_cost;
    }

    @Override
    public void initView() {
        StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimaryWhite), 0, true);
    }

    @OnClick({R.id.return_extracost, R.id.call_customer})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.return_extracost:
                finish();
                break;
            case R.id.call_customer:
                final KuaituDialog kuaituDialog2 = new KuaituDialog(mContext);
                kuaituDialog2.setTitle(getString(R.string.dialogTitle));
                kuaituDialog2.setMessage("是否拨打客服电话" + MyApplication.getInstance().getHotLine());
                kuaituDialog2.setYesOnclickListener("确定", new KuaituDialog.onYesOnclickListener() {
                    @Override
                    public void onYesClick() {
                        Intent intent = new Intent();
                        intent.setAction(Intent.ACTION_DIAL);
                        intent.setData(Uri.parse("tel:" + MyApplication.getInstance().getHotLine()));
                        startActivity(intent);
                        kuaituDialog2.dismiss();
                    }
                });
                kuaituDialog2.setNoOnclickListener("取消", new KuaituDialog.onNoOnclickListener() {
                    @Override
                    public void onNoClick() {
                        kuaituDialog2.dismiss();
                    }
                });
                kuaituDialog2.show();
                break;
        }
    }
}
